package dome4;


class Alg<T extends Comparable<T>> {
    public T findMax(T[] array) {
        T max = array[0];
        for (int i = 0; i < array.length; i++) {
            if(max.compareTo(array[i]) < 0) {
                max = array[i];
            }
        }
        return max;
    }
}

class Alg2<T> implements Comparable<T> {
    @Override
    public int compareTo(T o) {
        return 0;
    }
}

class Student implements Comparable<Student> {
    private String name;

    public Student(String name) {
        this.name = name;
    }

    @Override
    public int compareTo(Student o) {
        return this.name.compareTo(o.name);
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                '}';
    }
}

public class Text {
    public static void main(String[] args) {
        Student[] student = {
                new Student("xiaohong"),
                new Student("xiaoming"),
                new Student("xiaoliang"),
        };
        Alg<Student> alg = new Alg<Student>();
        Student ret = alg.findMax(student);
        System.out.println(ret);
    }
}
